import { defHttp } from '/@/utils/http/axios';
const authFieldLoadData = (cgformId, params) => defHttp.get({ url: `${'/api-online/online/cgform/api/authColumn'}/${cgformId}`, params });
const authFieldUpdateStatus = (params) => defHttp.put({ url: '/api-online/online/cgform/api/authColumn', params });
const authFieldUpdateCheckbox = (params) => defHttp.post({ url: '/api-online/online/cgform/api/authColumn', params });
const authButtonLoadData = (cgformId, params) => defHttp.get({ url: `${'/api-online/online/cgform/api/authButton'}/${cgformId}`, params });
const authButtonEnable = (params) => defHttp.post({ url: '/api-online/online/cgform/api/authButton', params });
const authButtonDisable = (id, params) => defHttp.put({ url: `${'/api-online/online/cgform/api/authButton'}/${id}`, params });
const authDataLoadData = (cgformId, params) => defHttp.get({ url: `${'/api-online/online/cgform/api/authData'}/${cgformId}`, params });
const authDataUpdateStatus = (params) => defHttp.put({ url: '/api-online/online/cgform/api/authData', params });
const authDataSaveOrUpdate = (params, isUpdate) => {
  if (isUpdate) {
    return defHttp.put({ url: '/api-online/online/cgform/api/authData', params });
  } else {
    return defHttp.post({ url: '/api-online/online/cgform/api/authData', params });
  }
};
const authDataDelete = (id, params) => defHttp.delete({ url: `${'/api-online/online/cgform/api/authData'}/${id}`, params });
const authFieldLoadTree = (cgformId, authType, params) => {
  const url = `${'/api-online/online/cgform/api/authPage'}/${cgformId}/${authType}`;
  return defHttp.get({ url, params });
};
const authDataLoadTree = (cgformId, params) => {
  const url = `${'/api-online/online/cgform/api/validAuthData'}/${cgformId}`;
  return defHttp.get({ url, params });
};
const authButtonLoadTree = (cgformId, authType, params) => {
  const url = `${'/api-online/online/cgform/api/authPage'}/${cgformId}/${authType}`;
  return defHttp.get({ url, params });
};
const loadRoleAuthChecked = (params) => defHttp.get({ url: '/api-online/online/cgform/api/roleAuth', params });
const saveAuthField = (roleId, cgformId, params) => {
  const url = `${'/api-online/online/cgform/api/roleColumnAuth'}/${roleId}/${cgformId}`;
  return defHttp.post({ url, params });
};
const saveAuthData = (roleId, cgformId, params) => {
  const url = `${'/api-online/online/cgform/api/roleDataAuth'}/${roleId}/${cgformId}`;
  return defHttp.post({ url, params });
};
const saveAuthButton = (roleId, cgformId, params) => {
  const url = `${'/api-online/online/cgform/api/roleButtonAuth'}/${roleId}/${cgformId}`;
  return defHttp.post({ url, params });
};
export {
  authFieldLoadData,
  authFieldUpdateStatus,
  authFieldUpdateCheckbox,
  authButtonLoadData,
  authButtonEnable,
  authButtonDisable,
  authDataLoadData,
  authDataSaveOrUpdate,
  authDataUpdateStatus,
  authDataDelete,
  authFieldLoadTree,
  loadRoleAuthChecked,
  authButtonLoadTree,
  saveAuthButton,
  authDataLoadTree,
  saveAuthData,
  saveAuthField,
};
